#!/bin/bash
set -e
OHSRC_DIR=../../../../..
PHONE_DIR=${OHSRC_DIR}/out/seek100/packages/phone

if [[ ! -d "${PHONE_DIR}/pac/" ]]; then
    mkdir ${PHONE_DIR}/pac/
fi

cp ./Scripts/* ${PHONE_DIR}/pac/. -f

cp ./ImageFiles/* ${PHONE_DIR}/images/. -f

#boot.img
./../kernel/mkbootimg/bin/mkbootimg --kernel ${PHONE_DIR}/images/Image \
--dt ${PHONE_DIR}/images/dt.img \
--ramdisk ${PHONE_DIR}/images/ramdisk.img --base 0x00000000 --pagesize 2048 \
--output ${PHONE_DIR}/images/boot.img

cd ${PHONE_DIR}/pac/

perl mkpac.pl

if [[ -f "seek100_userdebug.pac" ]]; then
    echo -e "\033[32m  seek100 build pac successful. \033[0m"
fi
